Use of logic connectors
NOT: !
•The "not" operator is used by placing the "not" symbol, !, before a boolean value.
//suppose that Julian stayed up late
bool julianStayedUpLate = true;
//will Julian be peppy tomorrow?
bool julianIsPeppy = !julianStayedUpLate;
What does this code do?
This example illustrates the "not" operator. At the end of this block of code, the variable julianIsPeppy will take on the opposite value of julianStayedUpLate. If julianStayedUpLate were false, then julianIsPeppy would be true. In this case, the opposite is true, so julianIsPeppy gets a value of false.